package com.etc.controller;


import com.etc.entity.Admin;
import com.etc.entity.AdminPojo;
import com.etc.service.AdminService;
import com.etc.service.OrderCountService;
import com.etc.service.impl.AdminServiceImpl;
import com.etc.service.impl.OrderCountServiceImpl;
import com.etc.util.ResponseData;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
//通过后端来处理跨域问题
@CrossOrigin
@RequestMapping("api")
public class OrderCountController {
    private OrderCountService service = new OrderCountServiceImpl();

    @GetMapping("ordercount")
    public ResponseData getOrderCount() {

        List orderCount = service.getOrderCount();

        ResponseData responseData = new ResponseData();
        if (orderCount.size()==0) {
            responseData.setMsg("fail");
        } else {
            responseData.setObj(orderCount);
        }
        return responseData;

    }
}
